using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CMS.BLL;
using CMS.BLL.Entity;

public partial class Admin_Contact_ContactAdd : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitData();
        }
    }
  
    private void InitData()
    {
        int nItemID = ConvertData.ConvertToInt(Request.QueryString[Config.ACTION_ID]);
        string URL = Config.ROOT + Pages.BackEnds.ADMIN + "?" + Config.PAGE + "=" + Pages.BackEnds.STR_CONTACT;
        try
        {
            if (nItemID > 0)
            {
                Contacts  objContactUs = new Contacts();
                objContactUs.LoadById(nItemID);
                lblEmail.Text = ConvertData.ConvertToString(objContactUs.Data.Email);
                lblFullName.Text = objContactUs.Data.Fullname;
                lblTelephone.Text = objContactUs.Data.Telephone;
                lblMainContent.Text = objContactUs.Data.MainContent;
                lblTelephone.Text = objContactUs.Data.Telephone;
                lblContactDate.Text =ConvertData.ConvertIntToDatetimeString(objContactUs.Data.CreatedDate);
                int Result = objContactUs.UpdateStatus(nItemID, EnumeType.ACTIVE);
            }
            else
            { Response.Redirect(URL); }
        }
        catch
        {
            Response.Redirect(URL);
        }

    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        string URL = Config.ROOT + Pages.BackEnds.ADMIN + "?" + Config.PAGE + "=" + Pages.BackEnds.STR_CONTACT;
        Response.Redirect(URL);
    }
}
